package cn.ncupyh.soft;

import java.util.Random;

public class Game_gedou {
    //属性
    private String name;
    private  int blood;
    private  String gender;
    private  String face;

//    外貌描述
    String[] boy = {"风流倜傥","英俊潇洒","五官端正","英姿飒爽","禁欲系男神"};
    String[] girl = {"美丽大方","温柔善良","清新可人","身材苗条","端庄贤惠"};

//    招式描述
    String[] hunted = {"A","B","C","D","E","F","G","H","I"};
//   受伤害的程度描述
    String[] injured = {"a","b","c","d","e","f","g","h","i"};

    //无参构造方法
    public Game_gedou() {
    }

    //有参构造方法
    public Game_gedou(String name, int blood,String gender) {
        this.name = name;
        this.blood = blood;
        this.gender = gender;
        setFace(gender);
    }

    //get&set
    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getFace() {
        return face;
    }


//    设置男女的长相随机值

    public void setFace(String gender) {
        Random r = new Random();
        if(gender == "男"){
//            创建随机值
        int ind = r.nextInt(boy.length);
        this.face = boy[ind];
        }else if(gender == "女"){
            int ind = r.nextInt(girl.length);
            this.face = girl[ind];
        }else{
            this.face = "面目狰狞";
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getBlood() {
        return blood;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    //定义方法:攻击别人

//    Game_gedou role1 = new Game_gedou();
//    Game_gedou role2 = new Game_gedou();
//    role1攻击role2;
//    方法的调用者去攻击去攻击参数
    public void attack(Game_gedou r ){
//      伤害随机数:
        Random in = new Random();
        System.out.println();
        int hunts =in.nextInt(20)+1;
//      随机招数--可修改
//       补充:souf(hunting,this.getname(),role.getname());
        int  sjzs = in.nextInt(hunted.length);
        String hunting = hunted[sjzs] ;
//        System.out.printf();

//        修改剩余血量
        int remainblood = r.getBlood() - hunts;
//        判断血量是否为负数
        remainblood = remainblood < 0 ? 0:remainblood;
//        修改被揍人的剩余血量
        r.setBlood(remainblood);

//        伤害由低到深0-n
//        根据剩余血量,判断被攻击后的反应
        if(remainblood >= 90){
//            souf(hunting[0],,);
        }else if(remainblood >= 80){
//            souf(hunting[1],,);
        }else if(remainblood >=70){
//            souf(hunting[2],,);
        }else if(remainblood >=20){
//            sout(hunting[n],,);
        }
//        换行
        System.out.println();
//     .
//     ...n

////        描述攻击的方法：
//        //        this 方法的调用者
//        System.out.println(this.getName() + "举起拳头打了" + r.getName() + "一下," +
//                "造成了" + hunts + "点伤害,B还剩" + remainblood + "点血.");
        }

        public void showface(){
            System.out.println("姓名为:" + getName() );
            System.out.println("血量为:" + getBlood() );
            System.out.println("性别为:" + getGender());
            System.out.println("颜值为:" + getFace() );
        }
}
